#define _CRT_SECURE_NO_WARNINGS 1
#include "seqlist.h"
void meun()
{
	printf("***********************************************************\n");
	printf("****1.添加学生数据****2.删除学生数据****3.展示学生数据*****\n");
	printf("****4.查找学生数据****5.修改学生数据****0     退出    *****\n");
	printf("***********************************************************\n");
}

int main()
{
	int op = -1;
	contact con;
	contactinit(&con);
	do {
		meun();
		printf("输入操作数\n");
		scanf("%d", &op);
		switch (op)
		{
		case(1):
			contactadd(&con);
			break;
		case(2):
			printf("选择删除方式\n");
			printf("1.按学生姓名删除\n");
			printf("2.按学生学号删除\n");
			int op1 = -1;
			scanf("%d", &op1);
			if (op1 == 1)
			{
				contactdel(&con);
			}
			else if (op1 == 2)
			{
				contactdelid(&con);
			}
			break;
		case(3):
			contactshow(&con);
			break;
		case(4):
			printf("选择查找方式\n");
			printf("1.按学生姓名查找\n");
			printf("2.按学生学号查找\n");
			int op3 = -1;
			scanf("%d", &op3);
			if (op3 == 1)
			{
				contactfind(&con);
			}
			else if (op3 == 2)
			{
				contactfindid(&con);
			}
			break;
		case(5):
			printf("选择修改方式\n");
			printf("1.按学生姓名修改\n");
			printf("2.按学生学号修改\n");
			int op2 = -1;
			scanf("%d", &op2);
			if (op2 == 1)
			{
				contactmodify(&con);
			}
			else if (op2 == 2)
			{
				contactmodifyid(&con);
			}
			break;
		case(0):
			printf("退出通讯录\n");
			break;
		default:
			printf("输入错误重新输入\n");
			break;
		}
	} while (op != 0);
	contactdestroy(&con);
	return 0;
}